
const express = require('express');
const cors = require('cors');
const bodyParser = require('body-parser');
const userRoutes = require('./route/route.js');

const app = express();
const port = 8848;
 
 
 
// 跨域
app.use(cors());
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));

// 路由
app.use('/api', userRoutes);

// 启动服务器
app.listen(port, () => {
    console.log(`服务器运行在 http://localhost:${port}`);
});
